<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>${r'${sysName}'}</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${r'${resRoot}'}/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${r'${resRoot}'}/css/main.css" media="all" />
	<link rel="stylesheet" href="${r'${resRoot}'}/layui/admin/admin.css" media="all" />
</head>
<body class="childrenBody">
	<div class="layui-fluid">   
          <div class="layui-card">
	<div class="layui-form layui-card-header layuiadmin-card-header-auto">
	<form id="searchForm" class="layui-form layui-form-pane" method="post" action=""  >
		<#list table.fields as field>
			<#if field.isSelect?? && field.isSelect=="1">
				<div class="layui-inline">
			    <label class="layui-form-label">${field.comment!}</label>
			    <div class="layui-input-block">
			    <#if field.htmlType?? && field.htmlType=="3">
				      <select name="${field.propertyName}" id="${field.propertyName}" lay-filter="${field.propertyName}Change" >
				        <option value="">请选择${field.comment!}</option>
				        <#if field.dictValue??>
				        ${r'<#list '}dictMap['${field.dictValue!}']?keys as key>
				        <option  ${r'<#if'} ${table.entityPath}?? && ${table.entityPath}.${field.propertyName}?? && ${table.entityPath}.${field.propertyName}==key > selected="selected" ${r'</#if>'} value="${r'${key}'}">${r'${'}dictMap['${field.dictValue!}'][key]${r'}'}</option>
				        ${r'</#list>'}
				        </#if>
				      </select>
			   	<#else>
			   		<#if field.propertyType=="LocalDateTime">
				      <input type="text" class="layui-input" id="${field.propertyName}"  onClick="WdatePicker({startDate:'%y-%M-%d 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true});" placeholder="yyyy-MM-dd" value="${r'<#if'} ${table.entityPath}?? && ${table.entityPath}.${field.propertyName}?? ${r'>${'}${table.entityPath}.${field.propertyName}?datetime}${r'</#if>'}" >
				      <#elseif field.propertyType=="Long" || field.propertyType=="Double" || field.propertyType=="Integer">
				      <input type="number" name="${field.propertyName}" id="${field.propertyName}" value="${r'<#if'} ${table.entityPath}?? && ${table.entityPath}.${field.propertyName}?? ${r'>${'}${table.entityPath}.${field.propertyName}!}${r'</#if>'}"  autocomplete="off" placeholder="请输入${field.comment!}" class="layui-input">
				      <#else>
				      <input type="text" name="${field.propertyName}" id="${field.propertyName}" value="${r'<#if'} ${table.entityPath}?? && ${table.entityPath}.${field.propertyName}?? ${r'>${'}${table.entityPath}.${field.propertyName}!}${r'</#if>'}"  autocomplete="off" placeholder="请输入${field.comment!}" class="layui-input">
			    	  </#if>
			    </#if>
			    </div>
			  </div>
			</#if>
		</#list>
	
		<div class="layui-inline">
		    <a class="layui-btn search_btn">查询</a>
		</div>
		<div class="layui-inline">
			<a class="layui-btn linksAdd_btn" style="background-color:#5FB878" href="javascript:void(0);" onclick="addData();">添加</a>
			<a class="layui-btn linksAdd_btn" href="javascript:void(0);" onclick="exportExcel();">导出</a>
		</div>
		</form>
	<div class="layui-form member_list">
	  	<table class="layui-table">
		    <colgroup>
				<col>
				<col>
				<col>
				<col>
				<col>
		    </colgroup>
		    <thead>
				<tr>
					<th>序号</th>
					<#list table.fields as field>
					<#if field.isShow?? && field.isShow=="0">
					${r'<!-- '}  <th>${field.comment!}</th> ${r'-->'}
					<#else>
					<th>${field.comment!}</th>
					</#if>
					</#list>
					<th>创建时间</th>
					<th>操作</th>
				</tr>
		    </thead>
		    <tbody>
		    	${r'<#list result.datas as data>'}
		    	<tr>
					${r'<td>${(result.pageNumber - 1)*result.pageSize + data_index+1}</td>'}
					<#list table.fields as field>
					<#if field.isShow?? && field.isShow=="0">
					<#if field.htmlType?? && field.htmlType=="0">
						<#if field.propertyType=="String" || field.propertyType=="Long">
						${r'<!-- '} <td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}! }${r'</#if>'}</td>${r'-->'}
						<#elseif field.propertyType=="Double">
						${r'<!-- '} <td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}?string('#.##') }${r'</#if>'}</td>${r'-->'}
						<#elseif field.propertyType=="LocalDateTime">
						${r'<!-- '} <td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}?datetime}${r'</#if>'}</td>${r'-->'}
						</#if> 
					<#elseif field.htmlType?? && field.htmlType=="1">
						${r'<!-- '} <td>${r'<#if'} data.${field.propertyName}??><img src="${r'${picUrlHost}'}${r'${data.'}${field.propertyName}! }" style="max-height: 25px" onclick="showPhoto('${r'${picUrlHost}'}${r'${data.'}${field.propertyName}! }');" >${r'</#if>'}</td>${r'-->'}
					<#elseif field.htmlType?? && field.htmlType=="3">
						<#if field.dictValue?? && field.dictValue!="" >
						${r'<!-- '} <td>${r'<#if'} data.${field.propertyName}??>${r'${'}dictMap['${field.dictValue}'][${r'data.'}${field.propertyName}]}${r'</#if>'}</td>${r'-->'}
						<#else>
						${r'<!-- '} <td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}! }${r'</#if>'}</td>${r'-->'}
						</#if>
					<#elseif field.htmlType?? && field.htmlType=="4">
					${r'<!-- '} <td>${r'<#if'} data.${field.propertyName}?? && data.${field.propertyName}?length &gt; 20 >${r'${data.'}${field.propertyName}?substring(0,20)}${r'<#else>'}${r'${data.'}${field.propertyName}!}${r'</#if>'}</td>${r'-->'}
					<#elseif field.htmlType?? && field.htmlType=="6">
					${r'<!-- '} <td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}?date}${r'</#if>'}</td>${r'-->'}
					<#elseif field.htmlType?? && field.htmlType=="7">
					${r'<!-- '} <td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}?datetime}${r'</#if>'}</td>${r'-->'}
					<#elseif field.htmlType?? && field.htmlType=="8">
					${r'<!-- '} <td>${r'<#if'} data.${field.propertyName}??>${r'${'}dictMap['${field.dictValue}'][${r'data.'}${field.propertyName}]}${r'</#if>'}</td>${r'-->'}
					</#if>
					<#else>
						<#if field.htmlType?? && field.htmlType=="0">
						<#if field.propertyType=="String" || field.propertyType=="Long">
						<td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}! }${r'</#if>'}</td>
						<#elseif field.propertyType=="Double">
						<td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}?string('#.##') }${r'</#if>'}</td>
						<#elseif field.propertyType=="LocalDateTime">
						<td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}?datetime}${r'</#if>'}</td>
						</#if> 
					<#elseif field.htmlType?? && field.htmlType=="1">
						<td>${r'<#if'} data.${field.propertyName}??><img src="${r'${picUrlHost}'}${r'${data.'}${field.propertyName}! }" style="max-height: 25px" onclick="showPhoto('${r'${picUrlHost}'}${r'${data.'}${field.propertyName}! }');" >${r'</#if>'}</td>
					<#elseif field.htmlType?? && field.htmlType=="3">
						<#if field.dictValue?? && field.dictValue!="" >
						<td>${r'<#if'} data.${field.propertyName}??>${r'${'}dictMap['${field.dictValue}'][${r'data.'}${field.propertyName}]}${r'</#if>'}</td>
						<#else>
						<td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}! }${r'</#if>'}</td>
						</#if>
					<#elseif field.htmlType?? && field.htmlType=="4">
					<td>${r'<#if'} data.${field.propertyName}?? && data.${field.propertyName}?length &gt; 20 >${r'${data.'}${field.propertyName}?substring(0,20)}${r'<#else>'}${r'${data.'}${field.propertyName}!}${r'</#if>'}</td>
					<#elseif field.htmlType?? && field.htmlType=="6">
					<td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}?date}${r'</#if>'}</td>
					<#elseif field.htmlType?? && field.htmlType=="7">
					<td>${r'<#if'} data.${field.propertyName}??>${r'${data.'}${field.propertyName}?datetime}${r'</#if>'}</td>
					<#elseif field.htmlType?? && field.htmlType=="8">
					<td>${r'<#if'} data.${field.propertyName}??>${r'${'}dictMap['${field.dictValue}'][${r'data.'}${field.propertyName}]}${r'</#if>'}</td>
					</#if>
					</#if>
					</#list>
					${r'<td>${data.createTime?datetime}</td>'}
					<td><a class="layui-btn layui-btn-normal layui-btn-xs" href="javascript:void(0);" onclick="openWin('${r'${base}'}/sys/${table.entityPath?substring(0, table.entityPath?length - 3)}/input','${r'${data.id}'}','修改详情');" ><i class="iconfont icon-edit"></i>修改</a>
					<a class="layui-btn layui-btn-normal layui-btn-xs" href="javascript:void(0);" onclick="openWin('${r'${base}'}/sys/${table.entityPath?substring(0, table.entityPath?length - 3)}/detial','${r'${data.id}'}','查看详情');" ><i class="iconfont"></i>详情</a> 
		        	<a class="layui-btn layui-btn-danger layui-btn-xs" href="javascript:void(0);" onclick="del('${r'${data.id}'}');" ><i class="layui-icon"></i>删除</a>
		        	</td>
				</tr>
				${r'</#list>'}
			</tbody>
		</table>
	</div>
	<div id="page"></div>
	</div>
	</div></div>
	<script type="text/javascript" src="${r'${resRoot}'}/layui/layui.js"></script>
	<script src="${r'${resRoot}'}/js/jquery.min.js?v=2.1.4"></script>
	<script src="${r'${resRoot}'}/layui/layui.all.js" charset="utf-8"></script>
	<script src="${r'${resRoot}'}/js/dateFormat.js"></script>
	<script src="${r'${resRoot}'}/js/layui-page-open.js"></script>
	${r'<#assign '}pageUrl=base+'/sys/${table.entityPath?substring(0, table.entityPath?length - 3)}/show?'>
	${r'<#include "/page/page1.html">'}
	<script>
	document.onkeydown = function (event) {
        var e = event || window.event;
        if (e && e.keyCode == 13) { //回车键的键值为13
        	$(".search_btn").click(); //调用登录按钮的登录事件
        }
    }; 
	function exportExcel() {
		var index = layer.msg('加载中...',{icon: 16,time:false,shade:0.8});
		$("#searchForm").attr("action","${r'${base}'}/sys/${table.entityPath?substring(0, table.entityPath?length - 3)}/export");
		$("#searchForm").submit();
		
		layer.close(index);
	}
	$(".search_btn").click(function(){ 
		  window.location.href="${r'${base}'}/sys/${table.entityPath?substring(0, table.entityPath?length - 3)}/show";
	  });
	
	  		function del(id){	
	  			layer.confirm('确定删除该条数据吗?', function(index){
  				 $.ajax({
  		    		 type : "post",
  		    		 url : "${r'${base}'}/sys/${table.entityPath?substring(0, table.entityPath?length - 3)}/del",
  		    		 data : {
  		    			  id : id
  		    			 },
  					 dataType : "json",
  					 async : false,
  					 success : function(data) {
  						 flag  = data.message;
  							if(flag != 0) {
  								layer.msg('删除成功！', {
  									  icon: 1,
  									  time: 2000 //2秒关闭（如果不配置，默认是3秒）
  									}, function(){
  									  //do something
  										window.location.reload();
  									});  

  								
  							} else {
  								layer.alert("数据错误，请完善数据！");
  							}
  					 }
  		    	 });
  			});
		}
			function showPhoto(url) {
			var jsonstr = "{'title':'','id':123,'start':0,'data':[{'alt':'图1','pid':666,'src':'" + url +"','thumb':''}]}";
			var json = eval('(' + jsonstr + ')');
			layer.photos({
			photos: json
			,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
			});
			}
	  		
</script>
</body>
</html>